﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class c_supplier
    {
        public string Address;//] [nvarchar](160) NULL,
        public string apar_gr_id;// nvarchar(25) NULL,
        public string apar_id;// nvarchar(25) NULL,
        public string apar_name;// nvarchar(255) NULL,
        public string bank_account;// nvarchar(35) NULL,
        public string client;// nvarchar(25) NULL,
        public string country_code;// nvarchar(25) NULL,
        public decimal credit_limit;// decimal(28, 3) NULL,
        public string currency;// nvarchar(25) NULL,
        public string description;// nvarchar(255) NULL,
        public string e_mail;// nvarchar(255) NULL,
        public string ExecutionID;// nvarchar(50) NULL,
        public DateTime PickedUpDate;// datetime NULL,
        public int PickedUpFlag;// int NULL,
        public string ResultDetails;// nvarchar(255) NULL,
        public string short_name;// nvarchar(10) NULL,
        public string status;// nvarchar(1) NULL,
        public string tax_code;// nvarchar(25) NULL,
        public string Telephone_1;// nvarchar(20) NULL,
        public string Telephone_2;// nvarchar(20) NULL,
        public string terms_id;// nvarchar(25) NULL,
        public string vat_reg_no;// nvarchar(25) NULL,
        public long agrtid;// bigint IDENTITY(1,1) NOT NULL,

        public c_supplier(SqlDataReader rd)
        {
            Address = rd["Address"] is DBNull ? Address : rd["Address"].ToString();
            apar_gr_id = rd["apar_gr_id"] is DBNull ? apar_gr_id : rd["apar_gr_id"].ToString();
            apar_id = rd["apar_id"] is DBNull ? apar_id : rd["apar_id"].ToString();
            apar_name = rd["apar_name"] is DBNull ? apar_name : rd["apar_name"].ToString();
            bank_account = rd["bank_account"] is DBNull ? bank_account : rd["bank_account"].ToString();
            client = rd["client"] is DBNull ? client : rd["client"].ToString();
            country_code = rd["country_code"] is DBNull ? country_code : rd["country_code"].ToString();
            credit_limit = rd["credit_limit"] is DBNull ? credit_limit : Convert.ToDecimal(rd["credit_limit"]);
            currency = rd["currency"] is DBNull ? currency : rd["currency"].ToString();
            description = rd["description"] is DBNull ? description : rd["description"].ToString();
            e_mail = rd["e_mail"] is DBNull ? e_mail : rd["e_mail"].ToString();
            ExecutionID = rd["ExecutionID"] is DBNull ? ExecutionID : rd["ExecutionID"].ToString();
            PickedUpDate = rd["PickedUpDate"] is DBNull ? PickedUpDate : Convert.ToDateTime(rd["PickedUpDate"]);
            PickedUpFlag = rd["PickedUpFlag"] is DBNull ? PickedUpFlag : Convert.ToInt32(rd["PickedUpFlag"]);
            ResultDetails = rd["ResultDetails"] is DBNull ? ResultDetails : rd["ResultDetails"].ToString();
            short_name = rd["short_name"] is DBNull ? short_name : rd["short_name"].ToString();
            status = rd["status"] is DBNull ? status : rd["status"].ToString();
            tax_code = rd["tax_code"] is DBNull ? tax_code : rd["tax_code"].ToString();
            Telephone_1 = rd["Telephone_1"] is DBNull ? Telephone_1 : rd["Telephone_1"].ToString();
            Telephone_2 = rd["Telephone_2"] is DBNull ? Telephone_2 : rd["Telephone_2"].ToString();
            terms_id = rd["terms_id"] is DBNull ? terms_id : rd["terms_id"].ToString();
            vat_reg_no = rd["vat_reg_no"] is DBNull ? vat_reg_no : rd["vat_reg_no"].ToString();
            agrtid = rd["agrtid"] is DBNull ? agrtid : Convert.ToInt32(rd["agrtid"]);
        }
    }
}
